import{j as e,u as N,r as k,d as z,a7 as M,w as B,v as S,c as I,_ as w,C as L,D as V}from"./vendor-BTunnNwh.js";import{u as g,ay as $,b5 as D,b6 as T}from"./index-DzCib9fG.js";import{C as A}from"./CloseIcon-DFqVe2BA.js";const F=()=>e.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M16 12C15.1111 13.1852 15.1111 14.8148 16 16C14.8148 15.1111 13.1852 15.1111 12 16C12.8889 14.8148 12.8889 13.1852 12 12C13.1852 12.8889 14.8148 12.8889 16 12Z",fill:"var(--fain-red)"}),e.jsx("path",{d:"M0.5 27.5L12 16M27.5 0.5L16 12M27.5 27.5L16 16M0.5 0.5L12 12M12 12V12C12.8889 13.1852 12.8889 14.8148 12 16V16M12 12V12C13.1852 12.8889 14.8148 12.8889 16 12V12M16 12V12C15.1111 13.1852 15.1111 14.8148 16 16V16M16 16V16C14.8148 15.1111 13.1852 15.1111 12 16V16",stroke:"var(--fain-red)",strokeLinecap:"round",strokeLinejoin:"round"})]}),R="_main_tvsc2_1",E="_close_tvsc2_11",O="_header_tvsc2_19",P="_text_tvsc2_28",q="_preparation_tvsc2_38",U="_loader_tvsc2_49",Z="_container_button_tvsc2_62",G="_loading_tvsc2_108",n={main:R,close:E,header:O,text:P,preparation:q,loader:U,container_button:Z,loading:G},te=({endpoint:u,header:x,text:j,fileSize:v,status:s,setStatus:b,changeStopModal:y,changeUpdaterModal:t,isAborted:i,abortDownload:d})=>{const{t:h}=N("modals"),{accessToken:p}=g(),r=k.useRef(!1),m=async()=>{if(!i&&!r.current){r.current=!0;try{const C=await(await fetch(u,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${p}`}})).json();b(C.message)}catch(c){console.error(m.name,c)}finally{r.current=!1}}};z(m,v!==null&&!i?1e3:null);const o=async()=>{try{await d(),t()}catch(c){console.error(o.name,c)}},_=()=>{t(),d()};return e.jsxs("div",{className:n.main,children:[e.jsx("div",{className:n.close,onClick:_,children:e.jsx(A,{})}),e.jsxs("div",{children:[e.jsx("h3",{className:n.header,children:x}),e.jsx("p",{className:n.text,children:j}),e.jsx("p",{className:n.preparation,children:isNaN(parseInt(s))?e.jsx("span",{className:n.loading,children:h(s)}):`${s}%`}),e.jsx("div",{className:n.loader,children:e.jsx(M,{progress:isNaN(parseInt(s))?0:s,variant:"progress",size:"160px"})})]}),e.jsx("div",{className:n.container_button,children:e.jsx($,{icon:F,text:h("abort the download"),onClick:o,type:"button",disabled:i})})]})},H="_main_655zp_1",J="_header_655zp_11",K="_text_655zp_20",Q="_container_buttons_655zp_29",W="_close_655zp_34",X="_button_655zp_41",a={main:H,header:J,text:K,container_buttons:Q,close:W,button:X,delete:"_delete_655zp_61"},ne=({endpoint:u,header:x,text:j,abortDownload:v,changeCheckModal:s,changeDeleteFileModal:b,changeStartModal:y})=>{const{t}=N("serverConfig"),{accessToken:i}=g(),[d]=B(),{openLoader:h,closeLoader:p}=S(),[r]=I(["sidebar","selectedBlock"]),m=r.selectedBlock?.block_id,o=async()=>{s();const f=h();try{await fetch(u,{method:"POST",headers:{Authorization:`Bearer ${i}`}}),y()}catch(l){console.error(o.name,l),d(t("error"),t("something went wrong, try again"),o.name)}finally{p(f)}},_=async()=>{const f=h();try{const l=r.sidebar===D.terminal;await T(l?m:void 0,l?"server-terminal":"default")}catch(l){console.error(o.name,l),d(t("error"),t("something went wrong, try again"),_.name)}finally{p(f)}},c=()=>{b(),s(),_()},C=()=>{s(),v(),_()};return e.jsxs("div",{className:a.main,children:[e.jsx("div",{className:a.close,onClick:C,children:e.jsx(w,{})}),e.jsxs("div",{children:[e.jsx("h3",{className:a.header,children:x}),e.jsx("p",{className:a.text,children:j})]}),e.jsxs("div",{className:a.container_buttons,children:[e.jsx("button",{className:a.button,icon:e.jsx(L,{}),type:"button",onClick:o,children:e.jsx("p",{children:t("update server")})}),e.jsxs("button",{className:a.delete,icon:e.jsx(w,{}),type:"button",color:"red",onClick:c,children:[e.jsx(V,{color:"red",children:e.jsx(w,{})}),e.jsxs("p",{children:[" ",t("delete the file")]})]})]})]})};export{F as C,te as D,ne as S};
//# sourceMappingURL=index-BLs-YiZ6.js.map
